import Http from "@/utils/request.js";
// import { getToken } from '@/utils/cookie'

/**
 *  BASIC HTTP API
 *
 */
export default class baseAPI {

  constructor(appID, baseService) {
    this.appID = appID
    this.baseService = baseService ? baseService : ''
  }

  request(options) {
    options.url = this.baseURL(options)
    options.method = options.method ? options.method : 'get'
    return Http({
      ...options
    })
  }

  uploadURL(options) {
    return process.env.VUE_APP_BASE_API + this.baseURL(options)
  }

  // uploadHeaders() {
  //   return {
  //     'interactive-key': getToken()
  //   }
  // }

  baseURL(options) {
    return options.url = process.env.NODE_ENV !== 'development' ? (this.appID + this.baseService + options.url) : options.url
  }

}